package com.example.demo;

import java.util.concurrent.TimeUnit;

import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.async.DeferredResult;

@Service
public class sendTaskSvc {
	private final org.slf4j.Logger logger = LoggerFactory.getLogger(this.getClass());

	@Async	
	public void execute(DeferredResult<String> deferred){		
		logger.info("进入线程");
		try {
			TimeUnit.SECONDS.sleep(2);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		logger.info("出线程");
	}
}
